from sqlalchemy import create_engine
from sqlalchemy.orm import DeclarativeBase
from sqlalchemy.orm import Session

DATABASE_URL = "sqlite:///data.db"


class Base(DeclarativeBase):
    pass


engine = create_engine(DATABASE_URL, echo=True)


def create_tables():
    Base.metadata.drop_all(engine)
    Base.metadata.create_all(engine)


def session():
    return Session(engine)
